@import './theme/default.less';
@import './mixins/index.less';
@c-border: @theme-stroke-5;
@c-light-border: @theme-stroke-7;
@c-white: @theme-stroke-10;
@c-blue: @theme-primary-2;
@c-light-gray: @theme-stroke-4;
@c-bg-gray: @theme-stroke-9;
@c-light-blue: @theme-primary-4;
@c-half-black: @theme-mask-black-2;
@errorBorderColor: @theme-error-2;

.zent-select {
  cursor: pointer;
  display: inline-block;
  font-size: 0;
  line-height: 1.5;
  margin-right: 10px;
  outline: none;
  position: relative;
  text-align: left;
  user-select: none;
  width: 160px;
  vertical-align: middle;

  &.disabled {
    color: @theme-stroke-6;
    cursor: not-allowed;

    .zent-select-input,
    .zent-select-text,
    .zent-select-tags {
      border-color: @theme-stroke-7;
      background-color: @c-bg-gray;

      &::after {
        opacity: 0.25;
      }
    }
  }

  .zent-select-text,
  .zent-select-popup,
  .zent-select-input,
  .zent-select-tags {
    font-size: 12px;
  }

  &__popover {
    width: 160px;
    line-height: 1.5;
    cursor: pointer;
    text-align: left;
    user-select: none;

    &.auto-width {
      width: auto;
    }
  }
}

.zent-select-input,
.zent-select-text,
.zent-select-tags {
  box-sizing: border-box;
  border: 1px solid @c-border;
  border-radius: 2px;
  display: inline-block;
  min-height: 30px;
  max-height: 76px;
  outline: none;
  padding: 5px 10px;
  transition: border-color 0.25s;
  width: 100%;
  background-color: @theme-stroke-10;
  position: relative;
}

.zent-select-placeholder {
  color: @c-light-gray;
}

.zent-select-simple {
  color: @c-blue;

  &::after {
    content: '';
    border-left: 4px solid transparent;
    border-top: 6px solid @c-blue;
    border-right: 4px solid transparent;
    display: inline-block;
    margin-left: 5px;
    height: 1px;
    transition: transform 0.25s;
  }
}

.zent-select-text {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  padding: 5px 20px 5px 10px;

  &::after {
    background: url() no-repeat;
    background-size: 6px 5px;
    content: '';
    height: 5px;
    margin-top: -3px;
    position: absolute;
    right: 10px;
    top: 50%;
    transition: transform 0.25s;
    width: 6px;
  }
}

.zent-select-tags {
  padding: 2px 5px;
  max-height: none;
  line-height: 24px;

  &::-webkit-scrollbar {
    display: none;
  }

  &.tags__empty {
    padding: 5px 20px 5px 10px;
    line-height: 18px;
  }

  .zent-select-inner {
    border: 0;
    display: inline-block;
    outline: none;
  }

  .zent-select-tag {
    background-color: @c-bg-gray;
    border: 1px solid @c-border;
    border-radius: 2px;
    display: inline-block;
    margin: 2px 0;
    margin-right: 2px;
    padding: 0 4px;
    line-height: 18px;
  }

  .zent-select-delete {
    background: url() no-repeat;
    background-size: 8px;
    display: inline-block;
    height: 8px;
    margin-left: 2px;
    width: 8px;
  }
}

.zent-select-popup {
   .popup();

  .zent-select-option,
  .zent-select-filter,
  .zent-select-empty {
    .popup-menu-item-common;
  }

  .zent-select-search {
    position: relative;
    box-sizing: border-box;

    &::before {
      background: url() no-repeat;
      background-position: center;
      background-size: 12px;
      content: '';
      height: 100%;
      left: 10px;
      position: absolute;
      width: 12px;
    }
  }

  .zent-select-filter {
    border-color: @c-light-border;
    border-style: solid;
    border-width: 0 0 1px;
    padding-left: 30px;
    width: 100%;
    box-sizing: border-box;
    height: 30px;
  }

  .zent-select-option {
    .popup-menu-item-specific;
  }

  .zent-select-empty {
    color: @c-light-gray;
  }
}

.has-error {
  :not(.no-error) {
    & > .zent-select-input,
    & > .zent-select-text,
    & > .zent-select-tags {
      border: 1px solid @errorBorderColor;
      color: @theme-error-2;
    }
  }
}
